@import '../../style/common.less';

.conic-gradient(@nums) {
  .loop(@nums) when (@nums > 0) {
    .loop(@nums - 1);

    background-image+: hsl(@nums*36, 100%, 50%);
  }

  background-image+: ~'conic-gradient(hsl(0, 100%, 50%)';
  .loop(@nums);

  background-image+_: ~')';
}

.color-body {
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-sizing: border-box;
  height: 500px;

  &-left {
    display: flex;
    align-items: center;
  }

  &-right {
    width: 500px;
    display: flex;
    align-content: center;
    margin-right: 60px;
  }
}

.color-picker {
  cursor: pointer;
  position: relative;
  width: 320px;
  height: 320px;
  border-radius: 50%;
  .conic-gradient(10);

  &-handle {
    position: absolute;
    width: 40px;
    height: 40px;
    background-color: #fff;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(78, 89, 105, 40%);
    transition: box-shadow, transform 0.3s ease;

    &:hover {
      box-shadow: 0 8px 20px rgba(0, 0, 0, 10%), 0 0 0 3px #ffffff40;
      transform: scale(1.04) translate(-50%, -50%);
    }
  }
}

.color-mask {
  position: absolute;
  width: 180px;
  height: 180px;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  background-color: var(--color-bg-1);
  border-radius: 100px;
  cursor: default;
}

.theme-btn {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 78px;
  line-height: 78px;
  text-align: center;
  height: 78px;
  box-shadow: var(--home-box-shadow);
  transform: translate(-50%, -50%);
  border-radius: 50%;
  cursor: pointer;
  font-size: 28px;
  color: var(--color-border-4);
  transition: var(--home-transition-1);

  &:hover {
    box-shadow: 0 8px 20px rgba(0, 0, 0, 10%);
    transform: scale(1.02) translate(-50%, -50%);
  }

  svg {
    color: rgb(var(--gray-8));
    opacity: 0.8;
  }
}

.color-palette {
  position: absolute;
  right: 0;
  left: 0;
  padding-left: calc((100% - @home-max-width) / 2 + 400px);
  border-left: 0;
  border-right: 0;
  background: var(--color-bg-1);
  display: flex;

  &-item {
    width: 20%;
    height: 500px;
  }

  &-item:last-child {
    border-top-right-radius: 8px;
    border-bottom-right-radius: 8px;
  }
}

.color-body {
  transition: opacity 300ms;
  position: relative;
}

.color-card {
  transition: opacity 200ms;
}

body[arco-theme='dark'] {
  .color-body {
    border-color: rgba(255, 255, 255, 12%);
  }

  .theme-btn {
    border: 1px solid rgba(255, 255, 255, 12%);
    box-shadow: none;

    &:hover {
      svg {
        color: var(--color-text-1);
      }
    }
  }
}
